<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>督察实战综合平台系统</title>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <link rel="stylesheet" href="${request.contextPath}/statics/css/bootstrap.min.css">
  <link rel="stylesheet" href="${request.contextPath}/statics/css/font-awesome.min.css">
  <link rel="stylesheet" href="${request.contextPath}/statics/css/login/login.css">
  <link rel="stylesheet" href="${request.contextPath}/statics/css/all-skins.min.css">
  <link rel="stylesheet" href="${request.contextPath}/statics/css/main.css">
  <!--[if lt IE 9]>

    <!--<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>-->
  <!--<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>-->
  <script src="${request.contextPath}/statics/libs/html5shiv.min.js"></script>
  <script src="${request.contextPath}/statics/libs/respond.min.js"></script>

</head>
<body class="hold-transition login-page">
    <div class="div-main" id="rrapp" v-cloak>
      <div class="login-body">
        <img src="${request.contextPath}/statics/images/login/login_background1.png" class="login-background"/>
        <div class="login-right">
          <div class="login-form">
            <div class="login-icon"></div>
          <h1 class="login-h1">督察实战综合平台系统</h1>
            <div>
              <input class="login-userName" v-model="username" type="text" placeholder="请输入您的警号">
            </div>
            <div>
              <input class="login-password" v-model="password" type="password" placeholder="请输入您的密码">
            </div>
            <div style="position: relative">
              <input class="login-validateCode" v-model="captcha" type="text" placeholder="请输入验证码" @keyup.enter="login"/>
              <img class="login-validateImg" alt="如果看不清楚，请单击图片刷新！" :src="src" @click="refreshCode"/>
            </div>
            <div>
              <input class="login-submit" type="button" value="登录" @click="login"/>
              <input class="pkilogin-submit" type="button" value="PKI登录" @click="pkilogin"/>
            </div>
          </div>
        </div>
      </div>
    </div>
<!-- /.login-box -->
<script src="${request.contextPath}/statics/libs/jquery.min.js"></script>
<script src="${request.contextPath}/statics/libs/vue.min.js"></script>
    <script src="${request.contextPath}/statics/plugins/layer/layer.js"></script>
<script src="${request.contextPath}/statics/libs/bootstrap.min.js"></script>
<script src="${request.contextPath}/statics/libs/jquery.slimscroll.min.js"></script>
<script src="${request.contextPath}/statics/libs/fastclick.min.js"></script>
<script type="text/javascript">
var vm = new Vue({
	el:'#rrapp',
	data:{
		username: '',
		password: '',
		captcha: '',
		error: false,
		errorMsg: '',
		src: 'captcha.jpg'
	},
	beforeCreate: function(){
		if(self != top){
			top.location.href = self.location.href;
		}
	},
	methods: {
		refreshCode: function(){debugger
			this.src = "captcha.jpg?t=" + $.now();
		},
		pkilogin: function () {


            window.location.href = "https:/41.226.0.16:8443/inspect-manage-back/pkilogin"
		},
		login: function (event) {
		    if(vm.username == '' || vm.username == null){
		      layer.msg("用户名不能为空！")
		      return;
		    }
		    if(vm.password == '' || vm.password == null){
		      layer.msg("密码不能为空！")
		      return;
		    }
			var data = "username="+vm.username+"&password="+vm.password+"&captcha="+vm.captcha;
			$.ajax({
				type: "POST",
			    url: "sys/login",
			    data: data,
			    dataType: "json",
			    success: function(result){debugger
					if(result.code == 0){//登录成功
						parent.location.href ='index.html';
					}else if(result.code == 1 || result.code == 2){
						parent.location.href ='apply.html?roleId=' + result.data.roleId + '&roleName=' + result.data.roleName +'&code=' + result.code +'&remark=' + result.data.remark;
					}else{
						vm.error = true;
						<!--vm.errorMsg = result.msg;-->
                          layer.msg(result.msg)
						vm.refreshCode();
					}
				}
			});
		}
	}
});
</script>
</body>
</html>
